<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div>
        <input type="button" value="显示" onclick="xianshi(123);">
        <input type="button" value="隐藏" onclick="yincang(456);">
        <br>
        <img src="lz.jpg" id='img' class="img">
    </div>
    <hr>
    <div>
        <P>班长</P>
        <P>组长</P>
        <P>组员</P>
        <input type="button" value="变色" onclick="bianse();">
    </div>
    <script type="text/javascript">
        function yincang() {
            var img = document.getElementById('img');
            img.style.display = 'none';
        }

        function xianshi() {
            var img = document.getElementById('img');
            img.style.display = 'block';
        }

        function bianse() {
            var p = document.querySelectorAll('p');
            for (var i = 0; i < p.length; i++) {

                p[i].style.backgroundColor = 'red';
            }
        }
    </script>
</body>

</html>